import type { QueryParams } from '@/views/equipment-archives/type'

const controller = getAjaxBaseUrl('/equipmentInfo', '/energy')

/** 分页查询设备档案列表 */
export function queryEquipmentInfoByPage(params: Partial<QueryParams> & {
  pageNumber: number
  pageSize: number
}) {
  return post(`${controller}/page`, params)
}

/** 查询所有的设备列表 */
export function getEquipmentInfoList() {
  return get(`${controller}/list`)
}

/** 根据设备ID获取设备详情 */
export function getEquipmentDetailById(equipmentId: number) {
  return get(`${controller}/detail`, { equipmentId })
}

/** 删除设备档案 */
export function deleteEquipmentInfoById(id: number) {
  return get(`${controller}/del`, { id })
}

/** 获取动态下拉组件的选项数据 */
export function getDynamicSelectOptions(url: string) {
  return get(`${SERVICE_ENERGY}${url}`)
}
